# Cassandra storage config YAML 
<% if @new_dc %>
auto_bootstrap: false
<% end %>
cluster_name: '<%= @cluster_name %>'
data_file_directories:
<% if @data_paths -%>
<% @data_paths.each do |val| -%>
   - <%= val %>
<% end -%>
<% else -%>
   - <%= @cassandra_base %>/data
<% end %>
commitlog_directory: <%= @cassandra_base %>/commitlog
# commit log.  when running on magnetic HDD, this should be a
# separate spindle than the data directories.
saved_caches_directory: <%= @cassandra_base %>/saved_caches
# should lay in the same HDD as data rather than commit log

seed_provider:
   - class_name: org.apache.cassandra.locator.SimpleSeedProvider
     parameters:
         - seeds: <% if @key_node %>"<%= @key_node %>"<% else %>"<%= @ipaddress %>"<% end %>

<% if @spin_disk %>
concurrent_reads: <%= @spin_disk.to_i * 16 %>
concurrent_writes: <%= @processorcount.to_i * 4 %>
concurrent_counter_writes: <%= @processorcount.to_i * 4 %>
memtable_flush_writers: <%= @spin_disk %>
trickle_fsync: false
concurrent_compactors: <%= @spin_disk %>
#trickle_fsync_interval_in_kb: 10240
compaction_throughput_mb_per_sec: 48
sstable_preemptive_open_interval_in_mb: 150
memtable_cleanup_threshold: 0.3
<% else %>
concurrent_reads: 128
concurrent_writes: 128
concurrent_counter_writes: 128
memtable_flush_writers: <%= @processorcount %>
trickle_fsync: true
trickle_fsync_interval_in_kb: 10240
concurrent_compactors: <%= @processorcount %>
compaction_throughput_mb_per_sec: 96 
sstable_preemptive_open_interval_in_mb: 300
memtable_cleanup_threshold: 0.7
<% end %>

num_tokens: 256
# initial_token:

#special custom for SEN clusters

memtable_allocation_type: offheap_objects 
<% if @spin_disk %>
memtable_heap_space_in_mb: 876
memtable_offheap_space_in_mb: 2048 
<% else %>
memtable_heap_space_in_mb: 2048
memtable_offheap_space_in_mb: 8192 
<% end %>
memory_allocator: NativeAllocator

key_cache_size_in_mb: 300
row_cache_size_in_mb: 2048 
file_cache_size_in_mb: 512

incremental_backups: false
# may be true for clusters holding more important data

tombstone_warn_threshold: 500000 #default 1000
tombstone_failure_threshold: 1000000 #default 100000
# (http://www.datastax.com/dev/blog/cassandra-anti-patterns-queues-and-queue-like-datasets)
# These thresholds may also be adjusted at runtime
# using the StorageService mbean.

cross_node_timeout: true
# Warning: before enabling this property make sure to ntp is installed
# and the times are synchronized between the nodes.

streaming_socket_timeout_in_ms: 30000
# Default value is 0, which never timeout streams.
# streaming_socket_timeout_in_ms: 0

endpoint_snitch: PropertyFileSnitch

hinted_handoff_enabled: true
max_hint_window_in_ms: 16200000 # default 3 hours
hinted_handoff_throttle_in_kb: 4096 
# Consider increasing this number when you have multi-dc deployments, since
# cross-dc handoff tends to be slower
max_hints_delivery_threads: 8 # default 2 

# Maximum throttle in KBs per second, total. This will be
# reduced proportionally to the number of nodes in the cluster.
batchlog_replay_throttle_in_kb: 4096 

authenticator: AllowAllAuthenticator
authorizer: AllowAllAuthorizer
permissions_validity_in_ms: 2000

partitioner: org.apache.cassandra.dht.Murmur3Partitioner

disk_failure_policy: stop
commit_failure_policy: stop

key_cache_save_period: 14400
# key_cache_keys_to_save: 100
row_cache_save_period: 0
# row_cache_keys_to_save: 100
# NOTE: if you perform counter deletes and rely on low gcgs, you should disable the counter cache.
counter_cache_size_in_mb:
counter_cache_save_period: 7200
# counter_cache_keys_to_save: 100

# commitlog_sync may be either "periodic" or "batch." 
# When in batch mode, Cassandra won't ack writes until the commit log
# has been fsynced to disk.  It will wait up to
# commitlog_sync_batch_window_in_ms milliseconds for other writes, before
# performing the sync.
# commitlog_sync: batch
# commitlog_sync_batch_window_in_ms: 50
# the other option is "periodic" where writes may be acked immediately
# and the CommitLog is simply synced every commitlog_sync_period_in_ms
# milliseconds. 
commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000
commitlog_segment_size_in_mb: 32

# memtable_cleanup_threshold defaults to 1 / (memtable_flush_writers + 1)
#memtable_cleanup_threshold: 0.11

#commitlog_total_space_in_mb: 8192

#memtable_flush_writers: 8
# A fixed memory pool size in MB for for SSTable index summaries. If left
# empty, this will default to 5% of the heap size.
index_summary_capacity_in_mb:
index_summary_resize_interval_in_minutes: 60

# TCP port, for commands and data
storage_port: 7000
# SSL port, for encrypted communication.  Unused unless enabled in
# encryption_options
ssl_storage_port: 7001

# Set listen_address OR listen_interface, not both. Interfaces must correspond
# to a single address, IP aliasing is not supported.
# Setting listen_address to 0.0.0.0 is always wrong.
listen_address: <%= @ipaddress %> 
# listen_interface: eth0

# internode_authenticator: org.apache.cassandra.auth.AllowAllInternodeAuthenticator

# Whether to start the native transport server.
# Please note that the address on which the native transport is bound is the
# same as the rpc_address. The port however is different and specified below.
start_native_transport: true
# port for the CQL native transport to listen for clients on
native_transport_port: 9042
# native_transport_max_threads: 128
# native_transport_max_frame_size_in_mb: 256

# Whether to start the thrift rpc server.
start_rpc: true
rpc_address: 0.0.0.0 
# rpc_interface: eth1
# port for Thrift to listen for clients on
rpc_port: 9160
broadcast_rpc_address: <%= @ipaddress %>
# enable or disable keepalive on rpc/native connections
rpc_keepalive: true
rpc_server_type: sync
# rpc_min_threads: 16
rpc_max_threads: 512 
# rpc_send_buff_size_in_bytes:
# rpc_recv_buff_size_in_bytes:

# internode_send_buff_size_in_bytes:
# internode_recv_buff_size_in_bytes:
thrift_framed_transport_size_in_mb: 15
snapshot_before_compaction: false
# forever lost data while drooping keyspace and tables
auto_snapshot: false 

column_index_size_in_kb: 64

batch_size_warn_threshold_in_kb: 5

# stream_throughput_outbound_megabits_per_sec: 200
# inter_dc_stream_throughput_outbound_megabits_per_sec:

read_request_timeout_in_ms: 7000 #default 5000
range_request_timeout_in_ms: 10000
# How long the coordinator should wait for writes to complete
write_request_timeout_in_ms: 4000 #default 2000
# How long the coordinator should wait for counter writes to complete
counter_write_request_timeout_in_ms: 8000
# How long a coordinator should continue to retry a CAS operation
# that contends with other proposals for the same row
cas_contention_timeout_in_ms: 4000
# How long the coordinator should wait for truncates to complete
# (This can be much longer, because unless auto_snapshot is disabled
# we need to flush first so we can snapshot before removing the data.)
truncate_request_timeout_in_ms: 60000
# The default timeout for other, miscellaneous operations
request_timeout_in_ms: 10000

# most users should never need to adjust this.
# phi_convict_threshold: 8

dynamic_snitch_update_interval_in_ms: 200 #default 100
dynamic_snitch_reset_interval_in_ms: 600000
dynamic_snitch_badness_threshold: 0.1

# request_scheduler -- Set this to a class that implements
# RequestScheduler, which will schedule incoming client requests
# according to the specific policy. This is useful for multi-tenancy
# with a single Cassandra cluster.
# NOTE: This is specifically for requests from the client and does
# not affect inter node communication.
# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place
# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of
# client requests to a node with a separate queue for each
# request_scheduler_id. The scheduler is further customized by
# request_scheduler_options as described below.
request_scheduler: org.apache.cassandra.scheduler.RoundRobinScheduler

# Scheduler Options vary based on the type of scheduler
# NoScheduler - Has no options
# RoundRobin
#  - throttle_limit -- The throttle_limit is the number of in-flight
#                      requests per client.  Requests beyond 
#                      that limit are queued up until
#                      running requests can complete.
#                      The value of 80 here is twice the number of
#                      concurrent_reads + concurrent_writes.
#  - default_weight -- default_weight is optional and allows for
#                      overriding the default which is 1.
#  - weights -- Weights are optional and will default to 1 or the
#               overridden default_weight. The weight translates into how
#               many requests are handled during each turn of the
#               RoundRobin, based on the scheduler id.
#
# request_scheduler_options:
#    throttle_limit: 80
#    default_weight: 5
#    weights:
#      Keyspace1: 1
#      Keyspace2: 5


server_encryption_options:
    internode_encryption: none
    keystore: conf/.keystore
    keystore_password: cassandra
    truststore: conf/.truststore
    truststore_password: cassandra
    # More advanced defaults below:
    # protocol: TLS
    # algorithm: SunX509
    # store_type: JKS
    # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA]
    # require_client_auth: false

# enable or disable client/server encryption.
client_encryption_options:
    enabled: false
    keystore: conf/.keystore
    keystore_password: cassandra
    # require_client_auth: false
    # Set trustore and truststore_password if require_client_auth is true
    # truststore: conf/.truststore
    # truststore_password: cassandra
    # More advanced defaults below:
    # protocol: TLS
    # algorithm: SunX509
    # store_type: JKS
    # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA]

# internode_compression controls whether traffic between nodes is
# compressed.
internode_compression: dc 

inter_dc_tcp_nodelay: false
